;***********************
;*    M.A.M.E. v202    *
;*   Einstein TC-01    *
;*   Script by .mad.   *
;*    November 2018    *
;***********************

; re-compiled version of Einstein MAME x64 v202.
; updated floppy drive emulation and Joystick support.
; * Use this for all .COM (1 file) and Protected disk loaders.
; (Drive reset/initialise is broken after loading 1 file.)
; XBAS [enter] (wait for BASIC to load), DIR or RUN"FILE" (!!Fails!!).
; Typing DIR or LOAD again, after the file error message, works.
; This error breaks Auto-Loading and many multi-file games in BASIC.
; Use MAME v191 to automate loading of all XBS files... with the GameBase disk set. ;)

;Set the keyboard to NATURAL mode ( -nat) for GameBase sendkeys to work.
;Once the game has loaded chage the keyboard mode to EMULATED, for games that require it.
;a few game disks have copy protection, these do not work in MAME yet.
;*They do work on REAL machines.

;choose the machine and desired screen mode. (only Einstein in this MAME)
Add_CLP(einstein -window -skip_gameinfo)

;--------------------------------------------
; Available Floppy Drive options.
; default = 3ss (no option required)
;--------------------------------------------
; 35dd    = 3.5" double density
; 35ssdd  = 3.5" single-sided double density
; 3ds     = 3" double-sided
; 3ss     = TEAC FD-30A FDD
; 525qd   = 5.25" quad density
; 525ssqd = 5.25" single-sided quad density
;--------------------------------------------

If GameType CONTAINS(mfi)
	;MESS Floppy Image. change floppy drive hardware (5.25 Single Sided Quad Density).
	Add_CLP( -i042:0 525ssqd -i042:1 525ssqd)
End If

;--------------------------
; Hardware Expansion Slots.
;--------------------------
If Key_slot CONTAINS(speculator)
	;Not fully emulated yet!
	Add_CLP( -pipe speculator)

ElseIf Key_slot CONTAINS(speech||covox)
	Add_CLP( -centronics covox)

ElseIf Key_slot CONTAINS(stereo||cstereo)
	Add_CLP( -centronics covox_stereo)
End If

;----------------------
; Attach the game disk.
;----------------------
If Key_boot CONTAINS(yes)
	;Inset a boot disk in Drive:0 and the game disk in Drive:1.
	Add_CLP( -floppydisk1 "%dbpath%/scripts/boot.dsk" -floppydisk2 %gamepathfile%)

Else
	;Assumes 3.5 Xtal DSK edited for Auto-loading.
	Add_CLP( -floppydisk1 %gamepathfile%)
End If

;------------------------------------------------------------
; Do you need to load the game file with Send Keys?.
; ! Most of GameBase disks are patched for auto-loading.
; Set the Keyboard to "Natural" mode, or Send Keys will NOT work!
; You MUST change the Keyboard back to "Emulated" Mode manually.
;------------------------------------------------------------

If Key_load CONTAINS(*)
	Add_CLP( -nat)
	;Load a .COM file from the DOS prompt.
	Run_Emulator_Send_Keys([10]%load_value%{ENTER}||80)

ElseIf Key_run CONTAINS(*)
	Add_CLP( -nat)
	; Load an .XBS file from the BASIC prompt (XBS.COM must be on the same disk).
	; If XBAS is not on the game disk? use the BOOT option above.

	Run_Emulator_Send_Keys([10]RUN"%run_value%"{ENTER}||80)

Else
	Run_Emulator()
End If

